#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QProgressBar>
#include <QLabel>

#include "iqtprojectgenerator.h"
#include "istatusupdater.h"

#include "generatorfileoutput.h"
#include "remotegenerator.h"

namespace Ui {
    class MainWindow;
}

class RcSession;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

public:
	void setActivePath(QString path);

protected:
    void changeEvent(QEvent *e);

private slots:
    void exitApplication();
    void openWidgetFile();
    void openHTMLDirectory();
    void openDocumentation();
    void openURL();
    void remoteContentFetched();
    void about();
    void closeProject();
    void preview();
    void build();
    void rebuild();
    void setPanningEnabled(bool enabled);
    void setTextSelectionEnabled(bool enabled);
    void openLogFile();
    void openSettingsDialog();
    void connectToRemoteCompiler();
    void openBuildDirectory();
    void installSis();

    void progressUpdated();
    void progressFinished(bool success);

    void platformChosen();

    void rcPropertiesRefreshedSlot(bool success,
                                   bool hasRcPropertiesChanged);

private:
    void setBuildActionsEnabled(bool enabled);
    void checkSettings();
    void setPlatform(QString platformName);
    void buildPlatformsMenu();

private:
    Ui::MainWindow *ui;

    IQtProjectGenerator *m_generator;
    GeneratorOutputView *m_outputView;
    QString m_currentFileOrDirectory;

    QProgressBar *m_progressBar;
    QLabel *m_statusBarLabel;
    RemoteGenerator *m_remote;

    bool m_buildEnabled;
    bool m_rebuildEnabled;
    IStatusUpdater *m_statusUpdater;

    QString m_platformId;

    RcSession * m_rcSession;
};

#endif // MAINWINDOW_H
